{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<style>
.file-item{float: left; position: relative; width: 110px;height: 110px; margin: 0 20px 20px 0; padding: 4px;}
.file-item .info{overflow: hidden;}
.uploader-list{width: 100%; overflow: hidden;}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑会员</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" name="edit_member" id="edit_member" method="post" action="{:url('edit_member')}">
                        <input type="hidden" name="id" value="{$member.id}">
                       
                         <div class="form-group">
                            <label class="col-sm-3 control-label">用户名：</label>
                            <div class="input-group col-sm-4">
                                <input id="account" type="text" class="form-control" name="account" placeholder="请输入账号" value="{$member.account}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">昵称：</label>
                            <div class="input-group col-sm-4">
                                <input id="nickname" type="text" class="form-control" name="nickname" placeholder="请输入昵称" value="{$member.nickname}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码：</label>
                            <div class="input-group col-sm-4">
                                <input id="password" type="text" class="form-control" name="password" placeholder="请输入密码" value="{$member.password}">
                            </div>
                        </div>
                        <!--<div class="form-group">-->
                        <!--    <label class="col-sm-3 control-label">提现密码：</label>-->
                        <!--    <div class="input-group col-sm-4">-->
                        <!--        <input id="password" type="text" class="form-control" name="txpassword" placeholder="请输入提现密码" value="{$member.txpassword}">-->
                        <!--        <b style="color:red;">为空密码则为默认</b>-->
                        <!--    </div>-->
                        <!--</div>-->
                        
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">头像：</label>
                            <div class="input-group col-sm-4">
                                <input type="hidden" id="data_photo" name="head_img"  value="{$member.head_img}">
                                <div id="fileList" class="uploader-list" style="float:right"></div>
                                <div id="imgPicker" style="float:left">选择头像</div>
                                <img id="img_data" class="img-circle" height="80px" width="80px" style="float:left;margin-left: 50px;margin-top: -10px;" src="/uploads/face/{$member.head_img}" onerror="this.src='/static/admin/images/head_default.gif'"/>
                            </div>
                        </div> 
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">qq：</label>
                            <div class="input-group col-sm-4">
                                <input id="qq" type="text" class="form-control" name="qq" placeholder="请输入代理qq" value="{$member.qq}">
                            </div>
                        </div>
                         <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">微信：</label>
                            <div class="input-group col-sm-4">
                                <input id="weixin" type="text" class="form-control" name="weixin" placeholder="请输入代理微信" value="{$member.weixin}">
                            </div>
                        </div>
						
						 <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">提现费率：</label>
                            <div class="input-group col-sm-4">
                                <select class="form-control m-b chosen-select" name="txfeilv" id="txfeilv">
                                   {for start="0" end="101"}
									
									  <option value="{$i}" {if $i==$member['txfeilv']}selected{/if}>{$i}%</option>
									{/for}
                                    
                                </select>
                            </div>
                        </div>
                        
					    <div class="hr-line-dashed"></div>
					    <div class="form-group">
                            <label class="col-sm-3 control-label">总代状态：</label>
                            <div class="input-group col-sm-4">
                                <select class="form-control m-b chosen-select" name="status_zong" id="status_zong">
                                    <option value="0"  {if 1==$member['status_zong']}selected{/if} >未开启</option>
                                	<option value="1"  {if 1==$member['status_zong']}selected{/if} >已开启</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">对应总代账号：</label>
                            <div class="input-group col-sm-4">
                                    <select class="form-control m-b chosen-select" name="zong_id">
                                        {foreach $zong_nname as $key=>$vo}
                                            <option value="0">默认为空</option>
                                            <option value ="{$vo.id}" {if $member['zong_id'] == $vo.id }selected{/if}>{$vo.account}</option>
                                        {/foreach}
                                    </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">支付通道：</label>
                            <div class="input-group col-sm-4">
                                <select class="form-control m-b chosen-select" name="zftd" id="zftd">
                                    <option value="0"  {if 1==$member['zftd']}selected{/if} >默认通道</option>
                                	<option value="1"  {if 1==$member['zftd']}selected{/if} >巅峰支付</option>
                                	<option value="2"  {if 2==$member['zftd']}selected{/if} >国际支付</option>
                                	<option value="3"  {if 3==$member['zftd']}selected{/if} >冈本支付</option>
                                	<option value="4"  {if 4==$member['zftd']}selected{/if} >冈本金蝶支付</option>
                                	<option value="5"  {if 5==$member['zftd']}selected{/if} >618支付</option>
                                	<option value="6"  {if 6==$member['zftd']}selected{/if} >蘑菇支付</option>
                                	<option value="7"  {if 6==$member['zftd']}selected{/if} >麻雀支付</option>
                                	<option value="8"  {if 6==$member['zftd']}selected{/if} >gogo支付</option>
                                	<option value="9"  {if 6==$member['zftd']}selected{/if} >鸡sir支付</option>
                                	<option value="10"  {if 6==$member['zftd']}selected{/if} >鸡sir支付宝</option>
                                </select>
                            </div>
                        </div>
                        <!-- <div class="form-group">-->
                        <!--    <label class="col-sm-3 control-label">快站域名：</label>-->
                        <!--    <div class="input-group col-sm-4">-->
                        <!--        <input id="weixin" type="text" class="form-control" name="kuaizhan" placeholder="请输入落地域名" value="{$member.luodi}">-->
                        <!--    </div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">入口域名：</label>
                            <div class="input-group col-sm-4">
                                    <select class="form-control m-b chosen-select" name="ename_first">
                                        {foreach $level1 as $key=>$vo}
                                           <option value ="{$vo.ename}" {if $vo.ename==$member['ename_first']}selected{/if}>{$vo.ename}---{$vo.suns}(数量/个)</option>
                                        {/foreach}
                                    </select>
                            </div>
                        </div>

                        <!--<div class="form-group">-->
                        <!--    <label class="col-sm-3 control-label">二级域名：</label>-->
                        <!--    <div class="input-group col-sm-4">-->
                        <!--        <select class="form-control m-b chosen-select" name="ename_two">-->
                        <!--            {foreach $level2 as $key=>$vo}-->
                        <!--                   <option value ="{$vo.ename}" {if $vo.ename==$member['ename_two']}selected{/if}>{$vo.ename}</option>-->
                        <!--             {/foreach}-->
                        <!--        </select>-->
                        <!--    </div>-->
                        <!--</div>-->
                       
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
                        
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>

<script type="text/javascript">
    var $list = $('#fileList');
    //上传图片,初始化WebUploader
    var uploader = WebUploader.create({
     
        auto: true,// 选完文件后，是否自动上传。   
        swf: '/static/admin/webupload/Uploader.swf',// swf文件路径 
        server: "{:url('Upload/uploadface')}",// 文件接收服务端。
        duplicate :true,// 重复上传图片，true为可重复false为不可重复
        pick: '#imgPicker',// 选择文件的按钮。可选。

        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/jpg,image/jpeg,image/png'
        },

        'onUploadSuccess': function(file, data, response) {
            $("#data_photo").val(data._raw);
            $("#img_data").attr('src', '/uploads/face/' + data._raw).show();
        }
    });

    uploader.on( 'fileQueued', function( file ) {
        $list.html( '<div id="' + file.id + '" class="item">' +
            '<h4 class="info">' + file.name + '</h4>' +
            '<p class="state">正在上传...</p>' +
        '</div>' );
    });

    // 文件上传成功
    uploader.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    }); 

    //提交
    $(function(){
        $('#edit_member').ajaxForm({
            beforeSubmit: checkForm, 
            success: complete, 
            dataType: 'json'
        });
        
        function checkForm(){
            if( '' == $.trim($('#account').val())){
                layer.msg('请输入用户名',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }

            if( '' == $.trim($('#nickname').val())){
                layer.msg('请输入昵称',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }
                       
            if( '' == $.trim($('#password').val())){
                layer.msg('请输入密码',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }

           

        }

        function complete(data){
            if(data.code==1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('member/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                return false;   
            }
        }   
    });

</script>
</body>
</html>